import { defineStore } from 'pinia'
import { ref } from 'vue'
import type { ArtistInfo } from '@/types/artist/index'
import { getArtistInfo } from '@/api/artist'

export const useArtistStore = defineStore('artist', () => {
  const baseInfo = ref<ArtistInfo>()
  const getBaseInfo = async (id: number) => {
    const { data } = await getArtistInfo(id)
    if (data.code !== 200) return ElMessage.error(data.message ?? '获取失败')
    baseInfo.value = data.data
  }

  return {
    baseInfo,
    getBaseInfo,
  }
})
